package com.bytedance.scenedemo.multi_stack;

import com.bytedance.scene.Scene;
import com.bytedance.scene.navigation.NavigationScene;
import com.bytedance.scene.navigation.NavigationSceneOptions;
import com.bytedance.scene.ui.ResourceTable;
import com.bytedance.scene.ui.template.BottomNavigationViewScene;
import com.bytedance.scene.ui.template.ItemInfo;
import com.bytedance.scene.utlity.SceneInstanceUtility;
import ohos.aafwk.content.IntentParams;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

public class MultiStackTabGroupScene extends BottomNavigationViewScene {

    public IntentParams getBundle(int index){
        IntentParams intentParams = new IntentParams();
        intentParams.setParam("index",index);
        return intentParams;
    }

    @Override
    protected LinkedHashMap<String, Scene> getSceneMap() {
        LinkedHashMap<String, Scene> map = new LinkedHashMap<>();

        NavigationScene navigationScene0= (NavigationScene) SceneInstanceUtility.getInstanceFromClass(NavigationScene.class,
                new NavigationSceneOptions(MultiStackTabChildScene.class,getBundle(0)).toBundle());
        NavigationScene navigationScene1= (NavigationScene) SceneInstanceUtility.getInstanceFromClass(NavigationScene.class,
                new NavigationSceneOptions(MultiStackTabChildScene.class,getBundle(1)).toBundle());
        NavigationScene navigationScene2= (NavigationScene) SceneInstanceUtility.getInstanceFromClass(NavigationScene.class,
                new NavigationSceneOptions(MultiStackTabChildScene.class,getBundle(2)).toBundle());

        map.put("主页", navigationScene0);
        map.put("搜索", navigationScene1);
        map.put("通知", navigationScene2);
        return map;
    }

    @Override
    protected List<ItemInfo> getTabList() {
        List<ItemInfo> list = new ArrayList<>();
        ItemInfo itemInfo = new ItemInfo();
        itemInfo.setTabName("主页");
        itemInfo.setColor(0xff4050B5);
        itemInfo.setIcon(ResourceTable.Media_ic_home_white_24dp);
        list.add(itemInfo);

        ItemInfo itemInfo2 = new ItemInfo();
        itemInfo2.setTabName("搜索");
        itemInfo2.setColor(0xff4050B5);
        itemInfo2.setIcon(ResourceTable.Media_sousuo);
        list.add(itemInfo2);

        ItemInfo itemInfo3 = new ItemInfo();
        itemInfo3.setTabName("通知");
        itemInfo3.setColor(0xff4050B5);
        itemInfo3.setIcon(ResourceTable.Media_ic_favorite_white_24dp);
        list.add(itemInfo3);
        return list;
    }

}
